
<form class="well form-horizontal span8" action="<?php echo base_url() . "admin.php/materia/actualizar" ?>" method="post">
    <legend>MODIFICAR DATOS DE LAS MATERIAS </legend>
    <?php foreach ($materia as $i => $mat) { ?>


        <div class="control-group">
            <label class="control-label" for="select03">CARRERAS</label>
            <div class="controls ">
                <select name="carrera" class="span3"
                        ONCHANGE="javascript:modificar(this.options[this.selectedIndex].value, '<?php echo (base_url()) . "admin.php/materia/actualizar" ?>', '<?php echo ($opc) ?>', '<?php echo ($ide_mat) ?>');">
                            <?php
                            if ($ide_car == -1)
                                echo ("<option value='-1' selected>Seleccionar Carrera</option>");
                            foreach ($carrera as $i => $car) {
                                echo ("<option value='" . $car["ide_car"] . "'");
                                echo (($ide_car == $car["ide_car"] ? " selected" : "") . ">");
                                echo ($car["nombre_car"] . "</option>");
                            }
                            ?>
                </select>
                <?php if (isset($msj_error)) { ?>
                    <div class='MensajeError'>
                        <?php echo ($msj_error); ?>
                    </div>
                <?php } ?>

            </div>
        </div>

        <div class="control-group">
            <label class="control-label" for="select03">Malla Curricular</label>
            <div class="controls ">
                <select id="select02" name="pensum" class="span3"
                        ONCHANGE="javascript:modificar1('<?php echo ($ide_car) ?>', '<?php echo (base_url()) . "admin.php/materia/actualizar" ?>',
                                            '<?php echo ($opc) ?>', '<?php echo ($ide_mat) ?>', this.options[this.selectedIndex].value);">
                            <?php
                            if ($ide_pen == -1)
                                echo ("<option value='-1' selected>Seleccionar Pensum</option>");

                            foreach ($pensum as $i => $pen) {
                                echo ("<option value='" . $pen["ide_pen"] . "'");
                                echo (($ide_pen == $pen["ide_pen"] ? " selected" : "") . ">");
                                echo ($pen["descripcion_pen"] . "-" . $pen["estado_pen"] . "</option>");
                            }
                            ?>

                </select>
                <?php if (isset($msj_error1)) { ?>
                    <div class='MensajeError'>
                        <?php echo ($msj_error1); ?>
                    </div>
                <?php } ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="select04">Lista de Semestres</label>
            <div class="controls ">
                <select id="select01"  name="ciclo" class="span3">
                    <?php
                    if ($ide_pen == -1)
                        echo ("<option value='-1' selected>Seleccionar Semestre</option>");
                    else
                        foreach ($ciclo as $i => $cic) {
                            echo ("<option value='" . $cic["ide_cic"] . "'");
                            echo (($ide_cic == $cic["ide_cic"] ? " selected" : "") . ">");
                            echo ($cic["codigo_cic"] . "-" . $cic["nombre_cic"] . "</option>");
                        }
                    ?>

                </select>
            </div>
        </div>


        <div class="control-group">
            <label class="control-label" for="select05">Eje de Formaci&oacute;on</label>
            <div class="controls ">
                <select id="select01"  name="ejeform_mat" class="span2">
                    <option value="1"  <?php echo (($mat["ejeform_mat"] == "1" ? " selected" : "") . ""); ?>>HUMINISTICA</option>
                    <option value="2"  <?php echo (($mat["ejeform_mat"] == "2" ? " selected" : "") . ""); ?>>BASICA</option>
                    <option value="3"  <?php echo (($mat["ejeform_mat"] == "3" ? " selected" : "") . ""); ?>>PROFESIONAL</option>
                    <option value="4"  <?php echo (($mat["ejeform_mat"] == "4" ? " selected" : "") . ""); ?>>OPTATIVA</option>

                </select>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label" for="select06">Campo de la Ciencia</label>
            <div class="controls ">
                <select id="select01"  name="campocien_mat" class="span3">
                    <option value="11" <?php echo (($mat["campocien_mat"] == "11" ? " selected" : "") . ""); ?>>LOGICA</option>
                    <option value="12" <?php echo (($mat["campocien_mat"] == "12" ? " selected" : "") . ""); ?>>MATEMATICAS</option>
                    <option value="22" <?php echo (($mat["campocien_mat"] == "22" ? " selected" : "") . ""); ?>>FISICA</option>
                    <option value="23" <?php echo (($mat["campocien_mat"] == "23" ? " selected" : "") . ""); ?>>QUIMICA</option>
                    <option value="24" <?php echo (($mat["campocien_mat"] == "24" ? " selected" : "") . ""); ?>>CIENCIAS DE LA VIDA</option>
                    <option value="33" <?php echo (($mat["campocien_mat"] == "33" ? " selected" : "") . ""); ?>>CIENCIAS TECNOLOGICAS</option>
                    <option value="53" <?php echo (($mat["campocien_mat"] == "53" ? " selected" : "") . ""); ?>>CIENCIAS ECONOMICAS</option>
                    <option value="57" <?php echo (($mat["campocien_mat"] == "57" ? " selected" : "") . ""); ?>>LINGUISTICA</option>
                    <option value="71" <?php echo (($mat["campocien_mat"] == "71" ? " selected" : "") . ""); ?>>ETICA</option>

                </select>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label" for="input03">C&oacute;digo de Materia</label>
            <div class="controls">
                <input type="text" class="input-medium span1"  name="codigo_mat" value="<?php echo $mat["codigo_mat"]; ?>">
                <li class="icon-asterisk"></li>
                <div class='MensajeError'>
                    <?php echo form_error('codigo_mat') ?>
                </div>

            </div>
        </div>

        <div class="control-group">
            <label class="control-label" for="input03">Nombre de Materia</label>
            <div class="controls">
                <input type="text" class="input-medium span3"  name="nombre_mat" value="<?php echo $mat["nombre_mat"]; ?>">
                <li class="icon-asterisk"></li>
                <div class='MensajeError'>
                    <?php echo form_error('nombre_mat') ?>
                </div>

            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="select07">Cr&eacute;ditos</label>
            <div class="controls ">
                <select id="select01"  name="creditos_mat" class="span3">

                    <option value='1' <?php echo (($mat["creditos_mat"] == 1 ? " selected" : "") . ""); ?>>UNO</option>
                    <option value='2' <?php echo (($mat["creditos_mat"] == 2 ? " selected" : "") . ""); ?>>DOS</option>
                    <option value='3' <?php echo (($mat["creditos_mat"] == 3 ? " selected" : "") . ""); ?>>TRES</option>
                    <option value='4' <?php echo (($mat["creditos_mat"] == 4 ? " selected" : "") . ""); ?>>CUATRO</option>
                    <option value='5' <?php echo (($mat["creditos_mat"] == 5 ? " selected" : "") . ""); ?>>CINCO</option>
                    <option value='6' <?php echo (($mat["creditos_mat"] == 6 ? " selected" : "") . ""); ?>>SEIS</option>
                    <option value='7' <?php echo (($mat["creditos_mat"] == 7 ? " selected" : "") . ""); ?>>SIETE</option>
                    <option value='8' <?php echo (($mat["creditos_mat"] == 8 ? " selected" : "") . ""); ?>>OCHO</option>

                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="select08">Tipo Materia</label>
            <div class="controls ">
                <select id="select11"  name="tipomat_mat" class="span3">
                    <option <?php echo (($mat["tipomat_mat"] == "TEORICA" ? " selected" : "") . ""); ?>>TEORICA</option>
                    <option <?php echo (($mat["tipomat_mat"] == "PRACTICA" ? " selected" : "") . ""); ?>>PRACTICA</option>

                </select>
            </div>

        </div>



        <div class="control-group">
            <label class="control-label" for="select09">Prerequisito1</label>
            <div class="controls ">
                <select id="select01"  name="requisito1_mat" class="span3">
                    <?php
                    echo ("<option value='0' selected>NINGUNA</option>");
                    if ($ide_pen != -1) {
                        foreach ($requisitos as $i => $req) {
                            echo ("<option value='" . $req["ide_mat"] . "' " . ($mat["requisito1_mat"] == $req["ide_mat"] ? " selected" : "") . ">");
                            echo ($req["codigo_cic"] . "-" . $req["nombre_mat"] . "</option>");
                        }
                    }
                    ?>

                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="select10">Prerequisito2</label>
            <div class="controls ">
                <select id="select01"  name="requisito2_mat" class="span3">
                    <?php
                    echo ("<option value='0' >NINGUNA</option>");
                    if ($ide_pen != -1) {
                        foreach ($requisitos as $i => $req) {
                            echo ("<option value='" . $req["ide_mat"] . "' " . ($mat["requisito2_mat"] == $req["ide_mat"] ? " selected" : "") . ">");
                            echo ($req["codigo_cic"] . "-" . $req["nombre_mat"] . "</option>");
                        }
                    }
                    ?>
                </select>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label" for="select11">Prerequisito3</label>
            <div class="controls ">
                <select id="select01"  name="requisito3_mat" class="span3">
                    <?php
                    echo ("<option value='0'>NINGUNA</option>");
                    if ($ide_pen != -1) {
                        foreach ($requisitos as $i => $req) {
                            echo ("<option value='" . $req["ide_mat"] . "' " . ($mat["requisito3_mat"] == $req["ide_mat"] ? " selected" : "") . ">");
                            echo ($req["codigo_cic"] . "-" . $req["nombre_mat"] . "</option>");
                        }
                    }
                    ?>


                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="select12">Prerequisito4</label>
            <div class="controls ">
                <select id="select01"  name="requisito4_mat" class="span3">
                    <?php
                    echo ("<option value='0'>NINGUNA</option>");
                    if ($ide_pen != -1) {
                        foreach ($requisitos as $i => $req) {
                            echo ("<option value='" . $req["ide_mat"] . "' " . ($mat["requisito4_mat"] == $req["ide_mat"] ? " selected" : "") . ">");
                            echo ($req["codigo_cic"] . "-" . $req["nombre_mat"] . "</option>");
                        }
                    }
                    ?>

                </select>
            </div>
        </div>

    <?php } ?>
    <fieldset>
        <div class="control-group"> 
            <div class="controls">
                <input type="hidden" name="ide_mat" value="<?php echo $mat["ide_mat"]; ?>">
                <input type="hidden"  name="txtopc" value="<?php echo $opc; ?>">

            </div>
        </div >
    </fieldset>

    <div class="controls">
        <?php if ($opc == 'upd') { ?>
            <button type="submit" class="btn">Modificar Datos</button>

        <?php } else { ?>
            <button type="submit" class="btn">Eliminar Datos</button>
        <?php } ?>
        <a href="<?php echo base_url() . "admin.php/materia/inicio" ?>">
            <img src="<?php echo base_url(); ?>commons/images/boton_volver.gif"></a>

    </div> 


</form>


